package com.juyu.miliao.api.dao.mysql;

import java.util.HashMap;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.juyu.miliao.api.domain.Visitor;

@Repository
public class VisitorDao {
	@Autowired
	private SqlSession sqlSession;
	
	public int insertOrUpdateVisitor(Visitor entity){
		return sqlSession.insert("insertOrUpdateVisitor", entity);
	}

	public int findCountVisitor(int tokenUserId, int id){
		Map<String, Object> params = new HashMap<>();
		params.put("tokenUserId", tokenUserId);
		params.put("id", id);
		return sqlSession.selectOne("findCountVisitor", params);
	}
	
}